package com.flower.common.page;

import java.io.Serializable;
import java.util.List;

/**
 * 分页相应封装
 * @author 黄静娜
 * @date 2019年12月13日 下午4:29:49
 */
public class PageResponse implements Serializable{

	/**
	 * 
	 */
	private static final long serialVersionUID = 1935533107666764534L;
	
	
	
	public PageResponse() {
		super();
	}
	public PageResponse(Integer pageStart,Integer pageTotal,Integer pageCount,List<?> data) {
		super();
		this.pageStart=pageStart;
		this.pageTotal=pageTotal;
		this.pageCount=pageCount;
		this.data=data;
		//计算得到总页数
		this.pageNum = (this.pageCount % this.pageTotal == 0)?
				this.pageCount / this.pageTotal:this.pageCount / this.pageTotal + 1;
		this.isLastPage = this.pageStart == this.pageNum? true:false;
		this.hasNextPage = this.pageStart < this.pageNum? true:false;
		this.hasPreviousPage = this.pageStart > 1?true:false;
		this.isFirstPage = this.pageStart == 1? true:false;
		this.prePage = this.pageStart == 1? this.pageStart:this.pageStart-1;
		this.nextPage = this.pageStart == this.pageNum? this.pageNum:this.pageStart+1;
	}
	/**总页数*/
	private Integer pageNum;
	/**是否是尾页*/
	private Boolean isLastPage;
	/**是否可以下一页*/
	private Boolean hasNextPage;
	/**是否可以上一页*/
	private Boolean hasPreviousPage;
	/**是否是首页*/
	private Boolean isFirstPage;
	/**
	 * 每页显示条数
	 */
	private Integer pageTotal;
	/**
	 * 总记录数
	 */
	private Integer pageCount;
	/**
	 * 每页数
	 */
	private Integer pageStart;
	/**上一页*/
	private Integer prePage;
	/**下一页*/
	private Integer nextPage;
	/**首页*/
	private Integer firstPage = 1;
	/**
	 * 数据
	 */
	private List<?> data;
	
	
	public Boolean getHasNextPage() {
		return hasNextPage;
	}
	public void setHasNextPage(Boolean hasNextPage) {
		this.hasNextPage = hasNextPage;
	}
	public Boolean getHasPreviousPage() {
		return hasPreviousPage;
	}
	public void setHasPreviousPage(Boolean hasPreviousPage) {
		this.hasPreviousPage = hasPreviousPage;
	}
	public Boolean getIsFirstPage() {
		return isFirstPage;
	}
	public void setIsFirstPage(Boolean isFirstPage) {
		this.isFirstPage = isFirstPage;
	}
	public Integer getPageNum() {
		return pageNum;
	}
	public void setPageNum(Integer pageNum) {
		this.pageNum = pageNum;
	}
	public Integer getPageTotal() {
		return pageTotal;
	}
	public void setPageTotal(Integer pageTotal) {
		if(pageTotal==null||pageTotal<=0) {
			pageTotal=10;
		}
		this.pageTotal = pageTotal;
	}
	public Integer getPageStart() {
		return pageStart;
	}
	public void setPageStart(Integer pageStart) {
		if(pageStart==null||pageStart<=0) {
			pageStart=1;
		}
		this.pageStart = pageStart;
	}
	public List<?> getData() {
		return data;
	}
	public void setData(List<?> data) {
		this.data = data;
	}
	public Integer getPageCount() {
		return pageCount;
	}
	public void setPageCount(Integer pageCount) {
		this.pageCount = pageCount;
	}
	public Boolean getIsLastPage() {
		return isLastPage;
	}
	public void setIsLastPage(Boolean isLastPage) {
		this.isLastPage = isLastPage;
	}
	public Integer getPrePage() {
		return prePage;
	}
	public void setPrePage(Integer prePage) {
		this.prePage = prePage;
	}
	public Integer getNextPage() {
		return nextPage;
	}
	public void setNextPage(Integer nextPage) {
		this.nextPage = nextPage;
	}
	public Integer getFirstPage() {
		return firstPage;
	}
	public void setFirstPage(Integer firstPage) {
		this.firstPage = firstPage;
	}
	
}
